{include file="public/header" /}
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>添加</h5>
                </div>
                <div class="ibox-content layui-form">
                    <div class="layui-row layui-col-space10 layui-form-item ">

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">名称：</label>
                            <div class="layui-input-block">
                                <input type="text" name="video_name"  lay-verify="required" placeholder="名称" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">所属分类：</label>
                            <div class="layui-input-block">
                                <select name="f_id">
                                    {volist name="info" id="vo"}
                                    <option value="{$vo.music_type_id}">{$vo.music_type_name}</option>
                                    {/volist}
                                </select>
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">所属模块：</label>
                            <div class="layui-input-block">
                                <select name="video_f_id">
                                    {volist name="info1" id="vo1"}
                                    <option value="{$vo1.video_modular_id}">{$vo1.video_modular_name}</option>
                                    {/volist}
                                </select>
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">所属名家：</label>
                            <div class="layui-input-block">
                                <select name="person_id" xm-select="select2" xm-select-search="" xm-select-search-type="dl">
                                    {volist name="info2" id="vo2"}
                                    <option value="{$vo2.person_id}">{$vo2.person_name}</option>
                                    {/volist}
                                </select>
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">所属剧团：</label>
                            <div class="layui-input-block">
                                <select name="person_troupe">
                                    {volist name="info4" id="vo4"}
                                    <option value="{$vo4.music_type_id}">{$vo4.music_type_name}</option>
                                    {/volist}
                                </select>
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">主要演员：</label>
                            <div class="layui-input-block">
                                <input type="text" name="video_performer"  lay-verify="required"  class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">是否可以下载：</label>
                            <div class="layui-input-block">
                                <select name="is_down">
                                    <option value="1">可以</option>
                                    <option value="2">不可以</option>
                                </select>
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">是否Vip：</label>
                            <div class="layui-input-block">
                                <select name="is_vip">
                                    <option value="1">否</option>
                                    <option value="2">是</option>
                                </select>
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">流派：</label>
                            <div class="layui-input-block">
                                <select name="video_lp">
                                    {volist name="info3" id="vo3"}
                                    <option value="{$vo3.hot_id}">{$vo3.hot_keyword}</option>
                                    {/volist}
                                </select>
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">年份：</label>
                            <div class="layui-input-inline">
                                <input type="text" name="video_year"  placeholder="年份" class="layui-input test-item" >
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">图片：</label>
                            <input type="hidden" name="video_img" id="lay-img" lay-verify="image">
                            <div class="layui-input-block">
                                <div id="lay-upload">上传图片</div>
                                <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;">
                                    预览图：
                                    <div class="layui-upload-list" id="lay-list">
                                    </div>
                                </blockquote>
                            </div>
                        </div>

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">音频介绍：</label>
                            <div class="layui-input-block">
                                <textarea name="video_intro" style="width:400px;height:200px"></textarea>
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">歌词：</label>
                            <div class="layui-input-block">
                                <textarea name="content" style="width:400px;height:200px"></textarea>
                            </div>
                        </div>
                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <div class="layui-input-block">
                                <button class="layui-btn" lay-submit="" lay-filter="component-form-element">添加
                                </button>
                                <button class="layui-btn layui-btn-primary" onclick="history.go(-1)">关闭</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{include file="public/footer" /}
<link rel="stylesheet" href="__JS__/qiniu2.0/index.css">
<script type="text/javascript" src='__JS__/qiniu2.0/qiniu.min.js'></script>
<script type="text/javascript" src='__JS__/qiniu2.0/widget.js'></script>
<script type="text/javascript" src='__JS__/qiniu2.0/common.js'></script><!--上传操作-->
<script type="text/javascript" src='__JS__/qiniu2.0/ui.js'></script><!--展示上传表格-->
<script type="text/javascript" src='__JS__/qiniu2.0/uploadWithSDK.js'></script><!--h5上传-->
<script type="text/javascript" src='__JS__/qiniu2.0/main.js'></script>
<script>
    //    var editor = wk.wang({elem:'#LAY_editor'});
    wk.uploadImg({size:5,type:'png,jpg,jpeg',url:"{:url('Upload/upload')}",domain:""});
    layui.use(['form','upload','layedit','laydate'], function() {
        var form = layui.form;
//        form.verify({
//            editor:function(value,item){
//                if(editor.txt.html() == '<p><br></p>'){
//                    return '请填写内容';
//                }
//            }
//        });
        form.on('submit(component-form-element)', function (data) {
//            data.field.new_content = editor.txt.html();
            $('.layui-btn').addClass('layui-disabled').attr('disabled','disabled');
            $.ajax({
                url:"{:url('add')}",
                type:'post',
                dataType:'json',
                data:data.field,
                success:function(res){
                    if (res.code == 200) {
                        wk.success(res.msg,"{:url('music/index')}")
                    } else {
                        wk.error(res.msg,'','$(".layui-btn").removeClass(\'layui-disabled\').removeAttr(\'disabled\');');
                    }
                }
            })
        });

        var laydate = layui.laydate;
        //同时绑定多个
        lay('.test-item').each(function(){
            laydate.render({
                elem: this
                ,format:'yyyy'
                ,type:'date'
                ,trigger: 'click'
            });
        });
//        form.on('select(role)', function(data){
//            if(data.value == 1){
//                $(".banner_link").removeClass('hidden');
//                $(".banner_cate").addClass('hidden');
//                $(".banner_new").addClass('hidden');
//            }else{
//                $(".banner_link").addClass('hidden');
//                $(".banner_cate").removeClass('hidden');
//                if(banner_cate == 3){
//                    $(".banner_new").removeClass('hidden');
//                }
//            }
//        });
//        form.on('select(role1)', function(data){
//            banner_cate = data.value;
//            if(data.value == 1){
//                $('.banner_new').addClass('hidden');
//            }else if(data.value == 2){
//                $('.banner_new').addClass('hidden');
//            }else {
//                $('.banner_new').removeClass('hidden');
//            }
//        });
    });
</script>

</body>
</html>
